<!--************************************************************ -->
<!--* 文件创建日期：2010                                  * -->
<!--* 文件修改日期：			                                   * -->
<!--************************************************************ -->
<!--JSP初始化设置-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.*" %>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.qs.po.*"%>
<%@page import="com.qs.vo.*"%>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.qs.service.*"%>
<%@page import="com.infomanage.util.Consts"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    QsEquEntryItem item = EquipmentEntryService.load(request, response, out);
    List<QsEquClass> classList = EquipmentClassService.loadList(request, response, out);
    String title = "";
    String code = "";
    double price = 0;
    String unit = "";
    String spec = "";
    int stock = 0;
    int classId = -1;
    if(item != null){
    	QsEquEntry entry = item.getBean();
    	QsEquClass equClass = item.getEquClass();
    	code = entry.getCode();
    	price = entry.getPrice();
    	spec = entry.getSpec();
    	stock = entry.getStock();
    	title = entry.getTitle();
    	unit = entry.getUnit();
    	classId = equClass.getId();
    }
%>
<html>
<head>
	<title>技术装备登记</title>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<link href="<%=request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/table.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/calendar.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/common.js"></script>
	<script type="text/javascript">
	   function init() {
		   if("" != "<%=itemId%>") { // 修改
			   form1.classId.value="<%=classId%>";
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

	   function validate(){
	   		if(form1.code.value == ""){
	   			alert("装备编码不能为空！");
	   			return true;
	   		}
	   		if(form1.title.value == ""){
	   			alert("装备名称不能为空！");
	   			return true;
	   		}
	   		if(form1.spec.value == ""){
	   			alert("规格型号不能为空！");
	   			return true;
	   		}
	   		if(form1.unit.value == ""){
	   			alert("计量单位不能为空！");
	   			return true;
	   		}
	   		return false;
	   }
	   
	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0"  onload="init();" onclick="">
	<form name="form1" action="entry_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>技术装备登记</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="30%">
					<col width="70%">
					<tr>
						<td class="field" >
							装备编码
						</td>
						<td>
							<input value="<%=code %>" type="text" style="width: 100%" name="code">
						</td>
					</tr>
					<tr>
						<td class="field" >
							装备名称
						</td>
						<td>
							<input value="<%=title %>" type="text" style="width: 100%" name="title">
						</td>
					</tr>
					<tr>
						<td class="field" >
							装备分类
						</td>
						<td>
							<select style="width: 100%" name="classId">
								<%
									for(QsEquClass equClass : classList){
								%>
									<option value="<%=equClass.getId() %>"><%=equClass.getTitle() %></option>
								<%
									}
								%>
							</select>
						</td>
					</tr>
					<tr>
						<td class="field" >
							规格型号
						</td>
						<td>
							<input value="<%=spec %>" type="text" style="width: 100%" name="spec">
						</td>
					</tr>
					<tr>
						<td class="field" >
							计量单位
						</td>
						<td>
							<input value="<%=unit %>" type="text" style="width: 100%" name="unit">
						</td>
					</tr>
					<tr>
						<td class="field" >
							库存
						</td>
						<td>
							<input value="<%=stock %>" type="text" style="width: 100%" name="stock">
						</td>
					</tr>
					<tr>
						<td class="field" >
							价格
						</td>
						<td>
							<input value="<%=price %>" type="text" style="width: 100%" name="price">
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>